package com.zxmzy.scaffold.core.widget.slideback

import android.app.Activity
import com.zxmzy.scaffold.core.ext.dp

/**
 * @author zhangxiaoming
 * @date 2023/8/31
 * @description
 */
class SlideBack {
    var slideView: ISlideView? = null //样式
    var onSlide: OnSlide? = null   //滑动监听
    var canSlideWidth: Int = 0 //左边触发距离

    companion object {
        fun create(): SlideBack {
            return SlideBack()
        }
    }

    fun attachToActivity(activity: Activity): SlideControlLayout {
        if (slideView == null) {
            slideView = DefaultSlideView(activity)
        }
        if (canSlideWidth == 0) {
            canSlideWidth = 18.dp()
        }
        return SlideControlLayout(activity, canSlideWidth, slideView!!, onSlide).attachToActivity(
            activity
        )
    }
}